package com.acceptable.qucun.file.entity.template;

import com.acceptable.qucun.generic.util.TimeUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author 巴斯罗斯·K·赫斯洛利
 * @since 2021-08-29
 */
@TableName("template_file")
public class TemplateFile extends Model<TemplateFile> {

    private static final long serialVersionUID=1L;

    public TemplateFile(){
        Date now = new Date();
        this.createTime = TimeUtil.date2LocalDateTime(now);
        this.lastModifyTime = TimeUtil.date2LocalDateTime(now);
    }

    /**
     * 文件号
     */
      @TableId(value = "file_id", type = IdType.AUTO)
    private Long fileId;

    /**
     * 文件号对应的文件的名称
     */
    @TableField("file_name")
    private String fileName = "新建文件";

    /**
     * 文件大小
     */
    @TableField("file_size")
    private Long fileSize = 0L;

    /**
     *  文件Md5
     */
    @TableField("file_md5")
    private String fileMd5 = "";

    /**
     *  文件Mime类型
     */
    @TableField("file_mime")
    private String fileMime = "";

    /**
     * 是否是文件夹 默认不是
     */
    @TableField("is_dict")
    private Boolean dict = false;

    /**
     * 父目录
     */
    @TableField("pid")
    private Long pid = 10000L;

    /**
     * 是否位于回收站
     */
    @TableField("is_deleted")
    @TableLogic
    private Boolean deleted = false;

    /**
     * 外键 参照user表的uid
     */
    @TableField("user_id")
    private Integer userId;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 最近修改时间
     */
    @TableField("last_modify_time")
    private LocalDateTime lastModifyTime;

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public String getFileMd5() {
        return fileMd5;
    }

    public void setFileMd5(String fileMd5) {
        this.fileMd5 = fileMd5;
    }

    public String getFileMime() {
        return fileMime;
    }

    public void setFileMime(String fileMime) {
        this.fileMime = fileMime;
    }


    public Boolean getDict() {
        return dict;
    }

    public void setDict(Boolean isDict) {
        this.dict = isDict;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean isDeleted) {
        this.deleted = isDeleted;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer uid) {
        this.userId = uid;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(LocalDateTime lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public List<TemplateFile> getSubFileList(){
        return null;
    }

    @Override
    protected Serializable pkVal() {
        return this.fileId;
    }

    @Override
    public String toString() {
        return "TemplateFile{" +
                "fileId=" + fileId +
                ", fileName='" + fileName + '\'' +
                ", fileSize=" + fileSize +
                ", fileMd5='" + fileMd5 + '\'' +
                ", fileMime='" + fileMime + '\'' +
                ", isDict=" + dict +
                ", parentDictId=" + pid +
                ", isDeleted=" + deleted +
                ", userId=" + userId +
                ", createTime=" + createTime +
                ", lastModifyTime=" + lastModifyTime +
                '}';
    }
}
